{extend name="layout" /}
{block name="css"}
<style type="text/css">
    label {
        font-size: 13px;
    }
</style>
{/block}
{block name="content"}
<div class="content">
    <!-- begin breadcrumb -->
    <ol class="breadcrumb pull-right">
        <li><a href="{:url('Admin/Index/index')}">首页</a></li>
        <li><a href="javascript:;">系统管理</a></li>
        <li><a href="javascript:;">角色管理</a></li>
        <li><a href="javascript:;">权限设置</a></li>
        <li class="active">{$roles['roles_name']}</li>
    </ol>
    <!-- end breadcrumb -->
    <!-- begin page-header -->
    <h1 class="page-header">分配权限
        <small></small>
    </h1>
    <!-- end page-header -->
    <div class="col-md-12">
        <div class="panel panel-inverse" data-sortable-id="index-1">
            <div class="panel-heading">
                <div class="panel-heading-btn">
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i
                            class="fa fa-expand"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i
                            class="fa fa-repeat"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning"
                       data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger"
                       data-click="panel-remove"><i class="fa fa-times"></i></a>
                </div>
                <h4 class="panel-title">修改当前角色：{$roles['roles_name']}</h4>
            </div>
            <div class="panel-body">
                <form action="{:url('Admin/Rolers/bindact',['roles_id' => $roles['roles_id']])}" method="POST">
                    {present name="roles"}
                    <div class="form-group">
                        <label>ID</label>
                        <input type="text" class="form-control" name="roles_id" readonly="" ="true" value="
                        {$roles['roles_id']}">
                    </div>
                    <div class="form-group">
                        <label>角色名称</label>
                        <input type="tetx" class="form-control" name="roles_name" value="{$roles['roles_name']}">
                    </div>
                    <div class="form-group">
                        <label>权限列表：</label>
                        {notempty name="access"}
                        {foreach $access as $access_item}
                        <label style="color: red;">
                            <input type="checkbox" class="form-control" name="ac_id[]" value="{$access_item['ac_id']}"
                                   {if condition="in_array($access_item['ac_id'],$access_id)" }checked{/if}>
                            {$access_item['ac_name']}
                        </label>
                        {/foreach}
                        {/notempty}
                        <hr>
                    </div>
                    <div class="form-group">
                        <button class="btn btn-primary" type="submit">确认分配权限</button>
                        <a href="{:url('Admin/Rolers/showrole')}">
                            <button type="button" class="btn btn-primary pull-right">返回角色列表</button>
                        </a>
                    </div>
                    {else /}
                    <div class="form-group">
                        <label>权限列表为空，请添加！</label>
                        <input type="text" class="form-control" name="roles_name">
                        <hr>
                        <button class="btn btn-primary" type="submit">确认添加</button>
                        <a href="#">
                            <button type="button" class="btn btn-primary pull-right">返回角色列表</button>
                        </a>
                    </div>
                    {/present}
                </form>
            </div>
        </div>
    </div>
</div>
{/block}